package com.catmiw.stock.old2008;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class CommonUtil {
    public static int bytesToInt(byte[] b){
        if (b==null||b.length!=4){
            return 0;
        }
        int rtn=0;
        for (int i=0;i<4;i++){
            rtn|=(b[i]<<24>>>(i*8));
        }

        return rtn;
    }
    public static void main(String args[]){
        byte[] b=new byte[4];
        b[0]=0x01;
        b[1]=0x2f;
        b[2]=(byte)0xab;
        b[3]=0x23;
        System.out.println(bytesToInt(b));
    }
    public CommonUtil() {
    }
}
